import os
import random
from glob import glob

clean_train_path = "/data2/linx/segan_dataset/clean_trainset_28spk_wav"
noisy_train_path = "/data2/linx/segan_dataset/noisy_trainset_28spk_wav"

clean_val_path = "/data2/linx/segan_dataset/clean_valset_28spk_wav"
noisy_val_path = "/data2/linx/segan_dataset/noisy_valset_28spk_wav"

if not os.path.exists(clean_val_path):
    os.mkdir(clean_val_path)
if not os.path.exists(noisy_val_path):
    os.mkdir(noisy_val_path)

# clean_train_wav_list.sort()
# person_list = list(set([os.path.basename(file_name).split("_")[0] for file_name in clean_train_wav_list]))
# person_list.sort()

# clean_train_wav_list = glob(f"{clean_train_path}/*p287*")
# for sorce_wav in clean_train_wav_list:
#     target_wav = "{}/{}".format(clean_val_path, os.path.basename(sorce_wav))
#     os.system(f"ln -s {sorce_wav} {target_wav}")

noisy_train_wav_list = glob(f"{noisy_train_path}/*p287*")
for sorce_wav in noisy_train_wav_list:
    target_wav = "{}/{}".format(noisy_val_path, os.path.basename(sorce_wav))
    os.system(f"ln -s {sorce_wav} {target_wav}")